package datastruct;

import java.util.HashMap;
import java.util.Map;
import java.util.Vector;

import dbConnections.MySQLConnection;

public class Column {
	protected String 				name="";
	protected int			 		type=0;
	protected int					size=0;
	protected int					position=0;
	
	public Column()
	{
		super();
	}
	
	public Column(String name)
	{
		super();
		this.name=name;
	}
	
	public Column(String name, int type)
	{
		super();
		this.name=name;
		this.type=type;
	}
	
	@Override
	public String toString()
	{
		String result;
		if (this.size>0)
			result = this.position + " " + this.name + " " + this.getTypeName() + "(" + this.type + ")" + "size:" + this.size;
		else
			result = this.position + " " + this.name + " " + this.getTypeName() + "(" + this.type + ")";
		return result;
	}
	
	public String getName()
	{
		return this.name;
	}
	
	public int getSize()
	{
		return this.size;
	}
	
	public int getType()
	{
		return this.type;
	}
		
	public String getTypeName()
	{
		return MySQLConnection.getTypeName(this.type);
	}
	
	public void setName(String name)
	{
		this.name=name;
	}
	
	public void setType(int type)
	{
		this.type=type;
	}
	
	
	public void setSize(int size)
	{
		this.size=size;
	}
}
